<%@page import="java.util.ArrayList"%>
<%@page import="bean.portDTO"%>
<%@page import="bean.PortfolioVo"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Portfolio.jsp</title>
<link rel='stylesheet' href='port.css'>
<script src='port.js'></script>
</head>
<body>
<%request.setCharacterEncoding("utf-8");%>
<jsp:useBean id="vo" class="bean.PortfolioVo" scope="page"/>
<jsp:setProperty property="*" name="vo"/>

<%
	request.setCharacterEncoding("utf-8");

	portDTO dto = new portDTO();
	dto.setVo(vo);
	ArrayList<PortfolioVo> al = dto.select();	
	
	String inc=request.getParameter("inc");
	if(inc==null) inc="dummy.jsp";
		
%>
<%if(inc=="dummy.jsp") {%>
	<div></div>
<%}else{%>
<div id='portView'><jsp:include page="<%=inc %>"/>
<%for(int a=8; a<9; a++){%>
	<div class="port_list<%=a%>">
	<%}%>
<%} %>
</div>

</div>
<form id='portFrm' method='post'> <!-- 상태 저장 form -->
	<input type='hidden' name='nowPage' value=<%=vo.getNowPage()%>>
	<input type='hidden' name='find' value=<%=vo.getFind()%>>
	<input type='hidden' name='rno' value=<%=vo.getRno()%>>	
		
</form>





<div id='a'>	

	<!-- 사진 이미지 출력 -->
<%for(int a=0; a<al.size(); a++){
	PortfolioVo pv = al.get(a);%>
	<div id="port_list<%=a%>"><!-- 이미지 계수에 맞추어 div 추가  -->
	<%if(pv.getPhoto() == null){%>
	
	<a href='#' onclick='goView(<%=dto.getNowPage()%>,<%=pv.getRno()%>)'>
	<img src="noimage.png" width=200px height=180px></a>
	<h2>[<%=pv.getCate()%>]<%=pv.getSubject()%></h2>
	<%}else{%>
	
	<a href='#' onclick='goView(<%=dto.getNowPage()%>,<%=pv.getRno()%>)'>	
	<img src='../memberPhoto/<%=pv.getPhoto()%>' width=200px height=180px></a>
	<h2>[<%=pv.getCate()%>]<%=pv.getSubject()%></h2>
	<%}%><br/>
	<%=vo.getSubject()%>
	</div>

<%}%>

</div>	

<div class='port_list_items'>

<div id='portFind'>
	<form name='port_list_frm' method='post' action='Portfolio.jsp'>
		<input type='text' name='find' value='<%=vo.getFind()%>'>
		<input type='submit' value='검색'><br/>
		<input type='button' id='btnInput' value='글쓰기'>

<!-- 아직 필요 없음 15.1 -->
<div id = 'port_list_page'>       
<a href='#' onclick='goPage(1)'>◀</a>
<%if(dto.getStartPage() !=1){%>
<a href='#' onclick='goPage(<%=dto.getStartPage()-1%>)'>◁</a>
<%} %>


<% 
int i=0;
for(i=dto.getStartPage(); i<=dto.getEndPage(); i++)
{%>
	<a href='#' onclick='goPage(<%=i%>)'><%=i%></a>
<% }%>

<%if(dto.getTotPage() != dto.getEndPage()){ %>
<a href='#' onclick='goPage(<%=i%>)'>▷</a>
<%} %>
<a href='#' onclick='goPage(<%=dto.getTotPage()%>)'>▶</a>
</div>
	</form>
</div>
</div>

<script>listInit();</script>
</body>
</html>